<?php

class myUser extends sfBasicSecurityUser
{
  public function getAreas()
  {
    if ($this->hasCredential('editor') || $this->hasCredential('admin'))
    {
      return Doctrine::getTable('Administrator')
        ->findOneById($this->getAttribute('id'))
        ->getAreas();
    }
  }
  
  public function getAreaIds()
  {
    if ($areas = $this->getAreas())
    {
      $areaIds = array();
      foreach ($areas as $area)
      {
        $areaIds[] = $area->getId();
      }
      
      return $areaIds;
    }
  }
}
